package com.evil.enterprise.controller;

import com.evil.application.api.RemoteApplicationOrderNodeService;
import com.evil.application.pojo.dto.order.OrderMyNodesReqDTO;
import com.evil.common.application.dto.process.node.NodeBaseDTO;
import com.evil.common.core.entity.R;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 应用订单节点接口
 *
 * @author liyang
 * @date 2022-08-08 00:00
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/application/order/node")
public class ApplicationOrderNodeController {

    private final RemoteApplicationOrderNodeService remoteApplicationOrderNodeService;

    /**
     * 我的节点列表
     *
     * @param orderMyNodesReqDTO orderMyNodesReqDTO
     * @return R
     */
    @PostMapping("/my-nodes")
    public R<List<NodeBaseDTO>> orderMyNodes(@Validated @RequestBody OrderMyNodesReqDTO orderMyNodesReqDTO) {
        return R.success(remoteApplicationOrderNodeService.orderMyNodes(orderMyNodesReqDTO));
    }
}
